package com.gitee.wsl.mathematics.interpolator.ext

import com.gitee.wsl.mathematics.interpolator.PercentOrRatio
import com.gitee.wsl.mathematics.interpolator.Ratio

inline operator fun Float.times(ratio: PercentOrRatio): Float = (this * ratio.value).toFloat()
inline operator fun Double.times(ratio: PercentOrRatio): Double = this * ratio.value
inline operator fun Int.times(ratio: PercentOrRatio): Double = this.toDouble() * ratio.value
inline operator fun Float.div(ratio: PercentOrRatio): Float = (this / ratio.value).toFloat()
inline operator fun Double.div(ratio: PercentOrRatio): Double = this / ratio.value
inline operator fun Int.div(ratio: PercentOrRatio): Double = this.toDouble() / ratio.value

//inline operator fun Ratio.unaryPlus(): Ratio = Ratio(+this.value)
//inline operator fun Ratio.unaryMinus(): Ratio = Ratio(-this.value)
//inline operator fun Ratio.plus(that: Ratio): Ratio = Ratio(this.value + that.value)
//inline operator fun Ratio.minus(that: Ratio): Ratio = Ratio(this.value - that.value)

//inline operator fun Ratio.times(that: Ratio): Ratio = Ratio(this.value * that.value)
inline operator fun PercentOrRatio.div(that: PercentOrRatio): Ratio = Ratio(this.value / that.value)
//inline operator fun Ratio.times(that: Double): Double = (this.value * that)
//inline operator fun Ratio.div(that: Double): Double = (this.value / that)

//inline operator fun Ratio.times(value: Ratio): Ratio = Ratio(this.value * value.value)

//inline operator fun Ratio.times(value: Float): Float = (this.value * value).toFloat()
//inline operator fun Ratio.times(value: Double): Double = this.value * value
//inline operator fun Ratio.div(value: Float): Float = (this.value / value).toFloat()
//inline operator fun Ratio.div(value: Double): Double = this.value / value
